package com.example.xiaomi.Model.Service;

import com.example.xiaomi.Model.Oop.mail;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;

@WebServlet("/mailbox")
public class login_QQmail extends HttpServlet {
    static int verification_code;
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        String java_Text_mail = req.getParameter("java_Text_mail");
        verification_code = (int) Math.round((Math.random()+1) * 1000);
        mail mail = new mail(java_Text_mail+"", "小米官网验证码", "<b>验证码</b>:<h5>"+verification_code+"<h5><br>" +
                "该验证码用于登陆，请勿将验证码泄流给别人！");
        req.setAttribute("code",verification_code);
        mail.start();
        PrintWriter out = resp.getWriter();
        out.println(verification_code);
    }
}
